package com.iwop.moto.service.impl;

import com.iwop.moto.dao.FCashBackRecordMapper;
import com.iwop.moto.model.FCashBackRecord;
import com.iwop.moto.service.FCashBackRecordService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service("fCashBackRecordService")
public class FCashBackRecordServiceImpl implements FCashBackRecordService {
 
	@Resource
    private FCashBackRecordMapper fCashBackRecordMapper;
	
	public FCashBackRecord searchById(Integer sid){
		return fCashBackRecordMapper.selectByPrimaryKey(sid);
	}

	@Override
	public List<FCashBackRecord> findByUserId(String userId) {
		return fCashBackRecordMapper.selectByUserId(userId);
	}

	@Transactional
	public int insert(FCashBackRecord fCashBackRecord) {
		return fCashBackRecordMapper.insert(fCashBackRecord);
	}
	
	@Transactional
	public int update(FCashBackRecord fCashBackRecord) {
		return fCashBackRecordMapper.updateByPrimaryKey(fCashBackRecord);
	}
	
	@Transactional
	public int delete(Integer sid){
		return fCashBackRecordMapper.deleteByPrimaryKey(sid);
	}
 
}